package com.kim.pong.router;

import com.kim.pong.service.PongService;
import lombok.SneakyThrows;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.server.RequestPredicates;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.RouterFunctions;
import org.springframework.web.reactive.function.server.ServerResponse;


@Configuration
public class PongRouter {

    @Bean
    public RouterFunction<ServerResponse> route(PongService pongService) {
        return RouterFunctions.route(
                RequestPredicates.GET("/pong"),
                pongService::handlePing
        );
    }
}
